package top.infopub.httpclient.base;

/**
 * HttpEnum 包括：MimeType，CharSet，Header，Method
 * @author Awoke
 * @version 2018-11-5
 * @see HttpEnum
 * @since
 */
public interface HttpEnum {

    /**
     * 常见报文请求的mime类型
     * @author Awoke
     * @version 2019年1月31日
     * @see MimeTypes
     * @since
     */
    enum MimeType implements HttpEnum {
        /**
         * application/x-www-form-urlencoded
         */
        FORM("application/x-www-form-urlencoded"),
        /**
         * application/json
         */
        JSON("application/json"),
        /**
         * text/plain
         */
        TXT("text/plain"),
        /**
         * text/xml
         */
        XML("text/xml"),
        /**
         * application/x-java-serialized-object
         */
        SERIALIZED_OBJECT("application/x-java-serialized-object");

        private String mimeType;

        public String getMimeType() {
            return mimeType;
        }

        private MimeType(String mimeType) {
            this.mimeType = mimeType;
        }
    }

    /**
     * 常见报文请求的字符集
     * @author Awoke
     * @version 2019年1月31日
     * @see MimeTypes
     * @since
     */
    enum CharSet implements HttpEnum {
        /**
         * UTF-8
         */
        UTF_8("UTF-8"),
        /**
         * GBK
         */
        GBK("GBK");

        private String charset;

        public String getCharset() {
            return charset;
        }

        private CharSet(String charset) {
            this.charset = charset;
        }
    }

    /**
     * 常见报文请求的header
     * @author Awoke
     * @version 2019年1月31日
     * @see MimeTypes
     * @since
     */
    enum Header implements HttpEnum {
        /**
         * Referer
         */
        REFERER("Referer"),
        /**
         * User-Agent
         */
        USER_AGENT("User-Agent"),
        /**
         * Cookie
         */
        COOKIE("Cookie");

        private String prop;

        public String getProp() {
            return prop;
        }

        private Header(String prop) {
            this.prop = prop;
        }
    }

    /**
     * 常见报文请求方法
     * @author Awoke
     * @version 2019年1月31日
     * @see MimeTypes
     * @since
     */
    enum Method implements HttpEnum {
        /**
         * POST
         */
        POST("POST"),
        /**
         * GET
         */
        GET("GET"),
        /**
         * PUT
         */
        PUT("PUT"),
        /**
         * DELETE
         */
        DELETE("DELETE"),
        /**
         * TRACE
         */
        TRACE("TRACE"),
        /**
         * CONNECT
         */
        CONNECT("CONNECT"),
        /**
         * HEAD
         */
        HEAD("HEAD");

        private String method;

        public String getMethod() {
            return method;
        }

        private Method(String method) {
            this.method = method;
        }
    }

}
